const Router = require('koa-router');


const cookbookByclass = require('../controllers/cookbook_data/cookbook_byclass')();
const cookbookDetail = require('../controllers/cookbook_data/cookbook_detail')();
const cookbookRecipeClass = require('../controllers/cookbook_data/cookbook_recipeClass')();
const cookbookSearch = require("../controllers/cookbook_data/cookbook_search")();

const register = require('../controllers/user/register')();
const login = require('../controllers/user/login')();
const favorites = require("../controllers/user/favorites")();
const like = require("../controllers/user/like")();
const deleteLike = require("../controllers/user/delete_like")();

module.exports = function () {
    var router = new Router();

    //cookbook data API
    router.get('/byclass', cookbookByclass);
    router.get('/detail', cookbookDetail);
    router.get('/recipeClass', cookbookRecipeClass);
    router.get('/search', cookbookSearch);

    router.post('/register', register);
    router.post('/login', login);

    //收藏页
    router.post('/favorites', favorites);
    //返回收藏菜单
    router.post('/like', like);
    router.post('/deleteLike', deleteLike);

    return router;
}